//
////package com.project2.service;
////
////import com.github.pagehelper.PageHelper;
////import com.github.pagehelper.PageInfo;
////import com.project2.bean.CommonData;
////import com.project2.bean.PageBo;
////import com.project2.bean.po.MarketFootprint;
////import com.project2.bean.po.MarketFootprintExample;
////import com.project2.bean.vo.BeanInListInDataInWxFootprintListVo;
////import com.project2.mapper.MarketFootprintMapper;
////import org.springframework.beans.factory.annotation.Autowired;
////import org.springframework.stereotype.Service;
////
////import java.util.ArrayList;
////import java.util.Date;
////import java.util.List;
////
/////**
//// * @author zhangminghui
//// * @date 2022/8/15
//// */
////@Service
////public class WxFootprintServiceImpl implements WxFootprintService {
////    @Autowired
////    MarketFootprintMapper marketFootprintMapper;
////
////    @Override
////    public CommonData<BeanInListInDataInWxFootprintListVo> queryDataInWxFootprintListVo(PageBo pageBo, Integer userId) {
////        PageHelper.startPage(pageBo.getPage(), pageBo.getLimit());
//////        MarketFootprintExample example = new MarketFootprintExample();
//////        if (pageBo.getSort() != null && pageBo.getOrder() != null) {
//////            example.setOrderByClause(pageBo.getSort() + " " + pageBo.getOrder());
//////        }
//////        // todo：这里传入的sort、order都为null，需要自己手动设计排序
//////        pageBo.setSort("add_time");
//////        pageBo.setOrder("desc");
//////        example.setOrderByClause(pageBo.getSort() + " " + pageBo.getOrder());
//////        MarketFootprintExample.Criteria criteria = example.createCriteria();
//////        criteria.andDeletedEqualTo(false);
//////        List<MarketFootprint> footprintList = marketFootprintMapper.selectByExample(example);
////
////        List<MarketFootprint> marketFootprintList = marketFootprintMapper.selectByCondition(userId);
////        PageInfo<MarketFootprint> pageInfo = new PageInfo<>(marketFootprintList);
////        CommonData commonData = CommonData.data(pageInfo);
////        List<BeanInListInDataInWxFootprintListVo> realFootprintList = new ArrayList<>();
////
////        //CommonData<BeanInListInDataInWxFootprintListVo> commonData = new CommonData<>();
////        //Boolean deleted = false;
////        Integer deleted = 0;
////        for (Object listVo : commonData.getList()) {
////            MarketFootprint listVo1 = (MarketFootprint) listVo;
////            // todo: 根据goodsId、userId、deleted查询出
////            //  要展示的浏览历史足迹
//////            BeanInListInDataInWxFootprintListVo bean = marketFootprintMapper.queryRealFootPrintListByGoodsIdAndDeleted(
//////                    listVo1.getGoodsId(), deleted);
//////            List<BeanInListInDataInWxFootprintListVo> beans = marketFootprintMapper.queryRealFootPrintListByGoodsIdAndUserIdAndDeleted(
//////                    listVo1.getGoodsId(), userId, deleted);
//////            // todo: deleted字段没有起到限制作用，deleted字段用来限制的是
//////            //  market_goods表，对market_footprint表没有任何影响
//////            //  根据上面查出来来的数据，默认是按照add_time升序排列，
//////            //  取最后一条数据就好
//////            if (beans.size() >= 1) {
//////                //realFootprintList.add(beans.get(0));
//////                realFootprintList.add(beans.get(beans.size()-1));
//////            }
////            BeanInListInDataInWxFootprintListVo bean = marketFootprintMapper.queryRealFootPrintListByGoodsIdAndUserIdAndDeleted(
////                    listVo1.getGoodsId(), userId, deleted);
////            if (bean != null) {
////                realFootprintList.add(bean);
////            }
////        }
////
////        commonData.setList(realFootprintList);
////        return commonData;
////    }
////
////    @Override
////    public void deleteFootprintById(Integer id) {
////        MarketFootprint marketFootprint = new MarketFootprint();
////        marketFootprint.setId(id);
////        marketFootprint.setDeleted(true);
////        marketFootprintMapper.updateByPrimaryKeySelective(marketFootprint);
////    }
////
////}
//
//package com.project2.service;
//
//import com.github.pagehelper.PageHelper;
//import com.github.pagehelper.PageInfo;
//import com.project2.bean.CommonData;
//import com.project2.bean.PageBo;
//import com.project2.bean.po.MarketFootprint;
//import com.project2.bean.po.MarketFootprintExample;
//import com.project2.bean.vo.BeanInListInDataInWxFootprintListVo;
//import com.project2.mapper.MarketFootprintMapper;
//import com.project2.service.WxFootprintService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @author zhangminghui
// * @date 2022/8/15
// */
//@Service
//public class WxFootprintServiceImpl implements WxFootprintService {
//    @Autowired
//    MarketFootprintMapper marketFootprintMapper;
//
//    @Override
//    public CommonData<BeanInListInDataInWxFootprintListVo> queryDataInWxFootprintListVo(PageBo pageBo, Integer userId) {
//        PageHelper.startPage(pageBo.getPage(), pageBo.getLimit());
//        MarketFootprintExample example = new MarketFootprintExample();
//        if (pageBo.getSort() != null && pageBo.getOrder() != null) {
//            example.setOrderByClause(pageBo.getSort() + " " + pageBo.getOrder());
//        }
//        // todo：这里传入的sort、order都为null，需要自己手动设计排序
//        pageBo.setSort("add_time");
//        pageBo.setOrder("desc");
//        example.setOrderByClause(pageBo.getSort() + " " + pageBo.getOrder());
//        MarketFootprintExample.Criteria criteria = example.createCriteria();
//        criteria.andDeletedEqualTo(false);
//        List<MarketFootprint> footprintList = marketFootprintMapper.selectByExample(example);
//        PageInfo<MarketFootprint> pageInfo = new PageInfo<>(footprintList);
//        CommonData commonData = CommonData.data(pageInfo);
//        List<BeanInListInDataInWxFootprintListVo> realFootprintList = new ArrayList<>();
//
//        //CommonData<BeanInListInDataInWxFootprintListVo> commonData = new CommonData<>();
//        //Boolean deleted = false;
//        Integer deleted = 0;
//        for (Object listVo : commonData.getList()) {
//            MarketFootprint listVo1 = (MarketFootprint) listVo;
//            // todo: 根据goodsId、userId、deleted查询出
//            //  要展示的浏览历史足迹
////            BeanInListInDataInWxFootprintListVo bean = marketFootprintMapper.queryRealFootPrintListByGoodsIdAndDeleted(
////                    listVo1.getGoodsId(), deleted);
//            List<BeanInListInDataInWxFootprintListVo> beans = marketFootprintMapper.queryRealFootPrintListByGoodsIdAndUserIdAndDeleted(
//                    listVo1.getGoodsId(), userId, deleted);
//            // todo: deleted字段没有起到限制作用，deleted字段用来限制的是
//            //  market_goods表，对market_footprint表没有任何影响
//            //  根据上面查出来来的数据，默认是按照add_time升序排列，
//            //  取最后一条数据就好
//            if (beans.size() >= 1) {
//                //realFootprintList.add(beans.get(0));
//                realFootprintList.add(beans.get(beans.size() - 1));
//            }
//        }
//        commonData.setList(realFootprintList);
//        return commonData;
//    }
//
//    @Override
//    public void deleteFootprintById(Integer id) {
//        MarketFootprint marketFootprint = new MarketFootprint();
//        marketFootprint.setId(id);
//        marketFootprint.setDeleted(true);
//        marketFootprintMapper.updateByPrimaryKeySelective(marketFootprint);
//    }
//
//}
//
